<?php

namespace App\Http\Controllers\mangercontroller;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Services\FileServiceInterFace;
use App\Services\RepotsServiceInterFace;

use Log;

class RepotsController extends Controller{

    private $reportService;

    public function __construct(RepotsServiceInterFace $reportServiceInterface)
    {
        $this->reportService = $reportServiceInterface;
    }

    public function ZhjyRepots(Request $request){
        $credentials = $request->validate([
            'currentPage' => 'required|integer',
            'pageSize' => 'required|integer',
        ]);
        return $this->reportService->getZhjyRepots($credentials);
    }

    public function updateZhjyRepots(Request $request){
        return $this->reportService->updateZhjyRepots($request);
       
    }

    public function deleteZhjyRepots(Request $request){
        $credentials = $request->validate([
            'ids' => ['required',function ($attribute, $value, $fail) {
                if (!is_array($value) && !is_string($value)) {
                    $fail($attribute.' 必须是数组或者字符串。');
                }
            }]
        ]);
        return $this->reportService->deleteZhjyRepots($credentials);
    }
}